package com.htl.exampro.user.pojo.domain;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author hehehe
 * @since 2025-05-26
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
@TableName("user")
@AllArgsConstructor
@Schema(name = "UserDO", description = "用户表")
public class UserDO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;
    public static final String USER_ID = "user_id";
    public static final String USERNAME = "username";
    public static final String PASSWORD = "password";
    public static final String REAL_NAME = "real_name";
    public static final String EMAIL = "email";
    public static final String PHONE = "phone";
    public static final String ROLE = "role";
    public static final String STATUS = "status";
    public static final String AVATAR_URL = "avatar_url";
    public static final String GENDER = "gender";
    public static final String BIRTHDAY = "birthday";
    public static final String LAST_LOGIN_IP = "last_login_ip";
    public static final String LAST_LOGIN_TIME = "last_login_time";
    public static final String ACCOUNT_LOCKED = "account_locked";
    public static final String CREATED_PERSON = "created_person";
    public static final String CREATED_TIME = "created_time";
    public static final String UPDATED_PERSON = "updated_person";
    public static final String UPDATED_TIME = "updated_time";
    public static final String IS_DELETED = "is_deleted";
    /**
     * 用户ID
     */
    @Schema(description = "用户ID")
    @TableId(value = "user_id", type = IdType.ASSIGN_ID)
    private Long userId;

    /**
     * 用户名
     */
    @TableField("username")
    @Schema(description = "用户名")
    private String username;

    /**
     * 密码
     */
    @TableField("password")
    @Schema(description = "密码")
    private String password;

    /**
     * 真实姓名
     */
    @TableField("real_name")
    @Schema(description = "真实姓名")
    private String realName;

    /**
     * 电子邮箱
     */
    @TableField("email")
    @Schema(description = "电子邮箱")
    private String email;

    /**
     * 联系电话
     */
    @TableField("phone")
    @Schema(description = "联系电话")
    private String phone;

    /**
     * 角色: 1-用户 0-管理员
     */
    @TableField("role")
    @Schema(description = "角色: 1-用户 0-管理员")
    private Byte role;

    /**
     * 状态（0禁用/1启用）
     */
    @TableField("status")
    @Schema(description = "状态（0禁用/1启用）")
    private Boolean status;

    /**
     * 头像地址
     */
    @TableField("avatar_url")
    @Schema(description = "头像地址")
    private String avatarUrl;

    /**
     * 性别（0:女/1:男）
     */
    @TableField("gender")
    @Schema(description = "性别（0:女/1:男）")
    private Boolean gender;

    /**
     * 出生日期
     */
    @TableField("birthday")
    @Schema(description = "出生日期")
    private LocalDate birthday;

    /**
     * 最后登录IP
     */
    @TableField("last_login_ip")
    @Schema(description = "最后登录IP")
    private String lastLoginIp;

    /**
     * 最后登录时间
     */
    @TableField("last_login_time")
    @Schema(description = "最后登录时间")
    private LocalDateTime lastLoginTime;

    /**
     * 账户锁定（0未锁/1锁定）
     */
    @TableField("account_locked")
    @Schema(description = "账户锁定（0未锁/1锁定）")
    private Byte accountLocked;

    /**
     * 创建人ID
     */
    @TableField(value = "created_person" ,fill = FieldFill.INSERT)
    @Schema(description = "创建人ID")
    private String createdPerson;

    /**
     * 创建时间
     */
    @TableField("created_time")
    @Schema(description = "创建时间")
    private LocalDateTime createdTime;

    /**
     * 修改人ID
     */
    @TableField(value = "updated_person" ,fill = FieldFill.UPDATE)
    @Schema(description = "修改人ID")
    private String updatedPerson;

    /**
     * 修改时间
     */
    @TableField("updated_time")
    @Schema(description = "修改时间")
    private LocalDateTime updatedTime;

    /**
     * 逻辑删除标志 0-未删除 1-已删除
     */
    @TableLogic
    @TableField("is_deleted")
    @Schema(description = "逻辑删除标志 0-未删除 1-已删除")
    private Boolean isDeleted;
}
